package com.tentcoo.core.event;

import com.tentcoo.util.ReflectionUtils;

public abstract class EventListener<T extends Event> {

	protected boolean temporary = false;

	public abstract void action(T event);

	public boolean isTemporary() {
		return this.temporary;
	}

	public void setTemporary(boolean temporary) {
		this.temporary = temporary;
	}

	@SuppressWarnings("unchecked")
	public Class<T> getEventClass() {
		return ReflectionUtils.getSuperClassGenericType(this.getClass(), 0);
	}

}
